﻿<Window x:Class="SaryaAccounting.Window2"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Window2" Height="325" Width="412">
    <Window.Resources>

    </Window.Resources>
    <Window.Style>
        <Style TargetType="{x:Type Window}">
            <Setter Property="FlowDirection" Value="RightToLeft" />
            <Setter Property="Foreground" Value="{StaticResource ForegroundBrush}" />
            <Setter Property="Background" Value="{StaticResource MainBrush}" />
            <Setter Property="Padding" Value="5" />
            <Setter Property="WindowStyle" Value="None" />
            <Setter Property="SnapsToDevicePixels" Value="True" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Window}">
                        <Grid Background="{TemplateBinding Background}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="2" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="55" />
                                <RowDefinition Height="1" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>

                            <Grid Grid.Column="2" Grid.Row="0">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Label Content="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.ViewInfo.Title}" Grid.Column="0" VerticalContentAlignment="Center" FontFamily="Sakkal Majalla" FontSize="36" Foreground="#9F000000" />
                                <Label Grid.Column="1" VerticalContentAlignment="Center">
                                    <TextBlock FontFamily="Tahoma" FontSize="11" Foreground="#BD003400" Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.ViewInfo.Description}" TextWrapping="Wrap" />
                                </Label>
                            </Grid>

                            <Rectangle Grid.Column="2" Grid.Row="1" Grid.ColumnSpan="2" Height="1" Margin="5,0,5,0" Name="rectangle1" Stroke="{StaticResource LightBrush}" />

                            <Border Name="CaptionBorder" Grid.Column="0" Grid.Row="0" Grid.RowSpan="3" HorizontalAlignment="Left" Margin="5,5,0,5" Width="150" 
                                CornerRadius="4" BorderThickness="1" BorderBrush="{StaticResource LightBrush}" Background="{StaticResource BackgroundLightBrush}">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="35" />
                                        <ColumnDefinition Width="2" />
                                        <ColumnDefinition Width="*" />
                                    </Grid.ColumnDefinitions>

                                    <StackPanel Orientation="Vertical" VerticalAlignment="Top" Grid.Column="0">
                                        <ToggleButton x:Name="OpMenuBtn" Width="20" Height="20" Margin="0,5,0,0" Focusable="False">
                                            <ToggleButton.Style>
                                                <Style TargetType="{x:Type ToggleButton}">
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="{x:Type ToggleButton}">
                                                                <Grid>
                                                                    <VisualStateManager.VisualStateGroups>
                                                                        <VisualStateGroup x:Name="CommonStates">
                                                                            <VisualState x:Name="Normal" />
                                                                            <VisualState x:Name="MouseOver" />
                                                                            <VisualState x:Name="Pressed" />
                                                                            <VisualState x:Name="Disabled" />
                                                                        </VisualStateGroup>
                                                                        <VisualStateGroup x:Name="CheckStates">
                                                                            <VisualState x:Name="Checked" />
                                                                            <VisualState x:Name="Unchecked" />
                                                                        </VisualStateGroup>
                                                                    </VisualStateManager.VisualStateGroups>
                                                                    <Rectangle x:Name="rect" Fill="Beige" Stroke="{StaticResource LightBrush}" Width="10" Height="10" />
                                                                </Grid>
                                                                <ControlTemplate.Triggers>
                                                                    <Trigger Property="IsChecked" Value="True">
                                                                        <Setter TargetName="rect" Property="Fill" Value="{StaticResource DarkBrush}" />
                                                                    </Trigger>
                                                                </ControlTemplate.Triggers>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </ToggleButton.Style>
                                        </ToggleButton>
                                        <Button x:Name="OperationsMenuButton" Width="20" Height="20" Margin="0,5,0,0" Focusable="False">
                                            <Button.Style>
                                                <Style TargetType="{x:Type Button}">
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="{x:Type Button}">
                                                                <Rectangle Fill="Beige" Stroke="{StaticResource LightBrush}" Width="10" Height="10" ContextMenu="{StaticResource OperationsMenu}" />
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </Button.Style>
                                        </Button>
                                    </StackPanel>

                                    <StackPanel Orientation="Vertical" VerticalAlignment="Bottom" Grid.Column="0">
                                        <Button x:Name="CloseButton" Width="20" Height="20" Margin="0,5,0,0" Focusable="False" Command="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=DataContext.CloseEditorCommand}">
                                            <Button.Style>
                                                <Style TargetType="{x:Type Button}">
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="{x:Type Button}">
                                                                <Grid Background="Transparent">
                                                                    <Border BorderThickness="1" Background="#00000000">
                                                                        <Path x:Name="closePath" Width="10" Height="10" Data="M0.28710935,3.5868225 L1.3359375,3.5868225 L3.515625,6.7626038 L3.5390625,6.7626038 L5.7070313,3.5868225 L6.7675781,3.5868225 L4.1074219,7.4481506 L6.890625,11.426666 L5.8183594,11.426666 L3.5214844,8.1044006 L3.4980469,8.1044006 L1.2011719,11.426666 L0.11718747,11.426666 L2.9238281,7.4247131 z" Fill="{StaticResource LightBrush}" RenderTransformOrigin=".5,.5" Stretch="Fill">
                                                                            <Path.RenderTransform>
                                                                                <TransformGroup>
                                                                                    <ScaleTransform />
                                                                                    <SkewTransform />
                                                                                    <RotateTransform />
                                                                                    <TranslateTransform />
                                                                                </TransformGroup>
                                                                            </Path.RenderTransform>
                                                                        </Path>
                                                                    </Border>
                                                                </Grid>
                                                                <ControlTemplate.Triggers>
                                                                    <Trigger Property="IsMouseOver" Value="True">
                                                                        <Setter TargetName="closePath" Property="Fill" Value="#FFFFAF00"/>
                                                                    </Trigger>
                                                                </ControlTemplate.Triggers>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </Button.Style>
                                        </Button>

                                        <ToggleButton x:Name="MaxAndNormalButton" Width="20" Height="20" Margin="0,7" Focusable="False">
                                            <ToggleButton.Style>
                                                <Style TargetType="{x:Type ToggleButton}">
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="{x:Type ToggleButton}">
                                                                <Grid Background="Transparent">
                                                                    <VisualStateManager.VisualStateGroups>
                                                                        <VisualStateGroup x:Name="CommonStates">
                                                                            <VisualState x:Name="Normal" />
                                                                            <VisualState x:Name="MouseOver">
                                                                                <Storyboard>
                                                                                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect1" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                        <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                                    </ColorAnimationUsingKeyFrames>
                                                                                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect2" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                        <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                                    </ColorAnimationUsingKeyFrames>
                                                                                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect2" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                                        <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                                    </ColorAnimationUsingKeyFrames>
                                                                                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect3" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                        <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                                    </ColorAnimationUsingKeyFrames>
                                                                                    <ColorAnimationUsingKeyFrames Storyboard.TargetName="rect4" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
                                                                                        <EasingColorKeyFrame KeyTime="0" Value="#FFB68211" />
                                                                                    </ColorAnimationUsingKeyFrames>
                                                                                </Storyboard>
                                                                            </VisualState>
                                                                            <VisualState x:Name="Pressed" />
                                                                            <VisualState x:Name="Disabled" />
                                                                        </VisualStateGroup>
                                                                        <VisualStateGroup x:Name="CheckStates">
                                                                            <VisualState x:Name="Checked">
                                                                                <Storyboard>
                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="canvas1" Storyboard.TargetProperty="(UIElement.Visibility)">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="canvas2" Storyboard.TargetProperty="(UIElement.Visibility)">
                                                                                        <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                </Storyboard>
                                                                            </VisualState>
                                                                        </VisualStateGroup>
                                                                    </VisualStateManager.VisualStateGroups>
                                                                    <Border BorderThickness="1">
                                                                        <Grid>
                                                                            <Canvas x:Name="canvas1" Margin="3,3,3,3">
                                                                                <Rectangle x:Name="rect1" Width="12" Height="12" Canvas.Left="0.011" Canvas.Top="0.066" Stroke="{StaticResource LightBrush}" />
                                                                                <Rectangle x:Name="rect2" Width="12" Height="4" Stroke="{StaticResource LightBrush}" Fill="{StaticResource LightBrush}" />
                                                                            </Canvas>
                                                                            <Canvas x:Name="canvas2" Margin="3,3,3,3" Visibility="Collapsed">
                                                                                <Rectangle x:Name="rect3" Width="8" Height="8" Canvas.Left="1" Canvas.Top="1" Stroke="{StaticResource LightBrush}" />
                                                                                <Rectangle x:Name="rect4" Width="8" Height="8" Canvas.Left="3" Canvas.Top="3" Stroke="{StaticResource LightBrush}" />
                                                                            </Canvas>
                                                                        </Grid>
                                                                    </Border>
                                                                </Grid>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </ToggleButton.Style>
                                        </ToggleButton>

                                        <Button x:Name="MinButton" Width="20" Height="20" Margin="0" Focusable="False">
                                            <Button.Style>
                                                <Style TargetType="{x:Type Button}">
                                                    <Setter Property="Template">
                                                        <Setter.Value>
                                                            <ControlTemplate TargetType="{x:Type Button}">
                                                                <Grid Background="Transparent">
                                                                    <Border BorderThickness="0" />
                                                                    <Rectangle x:Name="minRect" Height="2" RadiusX=".5" RadiusY=".5" Fill="{StaticResource LightBrush}" Margin="1,5" />
                                                                </Grid>
                                                                <ControlTemplate.Triggers>
                                                                    <Trigger Property="IsMouseOver" Value="True">
                                                                        <Setter Property="Fill" TargetName="minRect" Value="#FFB58110"/>
                                                                    </Trigger>
                                                                </ControlTemplate.Triggers>
                                                            </ControlTemplate>
                                                        </Setter.Value>
                                                    </Setter>
                                                </Style>
                                            </Button.Style>
                                        </Button>
                                    </StackPanel>

                                    <Rectangle Grid.Column="1" Width="1" Stroke="{StaticResource LightBrush}" />

                                    <ToolBarPanel Orientation="Horizontal" Grid.Column="2">
                                        <ToolBarTray Orientation="Vertical">
                                            <ToolBar>
                                                <Button Content="حفظ" />
                                                <Button Content="حفظ وجديد" />
                                                <Button Content="حفظ وإغلاق" />
                                                <Separator />
                                                <Button Content="طباعة" />
                                                <Separator />
                                                <Button Content="السجل الأول" />
                                                <Button Content="السجل السابق" />
                                                <Button Content="السجل التالي" />
                                                <Button Content="السجل الأخير" />
                                            </ToolBar>
                                        </ToolBarTray>
                                    </ToolBarPanel>
                                    <!--<StackPanel Orientation="Vertical" Grid.Column="2">
                                        <Border BorderThickness="1" BorderBrush="{StaticResource LightBrush}" Background="Beige" Height="32">
                                            <Grid>
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="40*" />
                                                    <ColumnDefinition Width="60*" />
                                                </Grid.ColumnDefinitions>
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto" />
                                                </Grid.RowDefinitions>
                                                
                                                <Label Grid.Column="0" Content="حفظ" FontFamily="Tahoma" FontSize="12" VerticalAlignment="Center" />
                                                <Label Grid.Column="1" Content="Ctrl + S" HorizontalContentAlignment="Right" VerticalContentAlignment="Bottom" />
                                            </Grid>
                                            
                                        </Border>
                                        <Button Height="32" Content="حفظ" />
                                        <Button Height="32" Content="حفظ" />
                                        <Button Height="32" Content="حفظ" />
                                        <Button Height="32" Content="حفظ" />
                                    </StackPanel>-->
                                </Grid>
                            </Border>

                            <Border Grid.Column="2" Grid.Row="3" Margin="5" BorderThickness="0">
                                <ContentPresenter HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Focusable="False" />
                            </Border>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Style>
    <Grid>

    </Grid>
</Window>
